package com.aaa.member.controller.api;

import com.aaa.entity.Member;
import com.aaa.member.service.MemberService;
import com.aaa.security.annotation.MyLog;
import com.aaa.vo.HeadVo;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.index.GeoIndexed;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 崔灿
 * @Date 2023/03/04 08:57
 * @ClassName MemberController
 * @Description
 * @Version 1.0
 */

@Api(value = "/member/membercontroller", tags = {"会员"})
@RestController
@RequestMapping("/member/membercontroller")
public class MemberController {
    @Autowired
    private MemberService memberService;

    /**
     * #Description selectmember
     * @param
     * @return
     * @author 崔灿
     * #Date
     */

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
            @ApiImplicitParam(paramType = "body", dataType = "Member", name = "member", value = "", required = true)
    })
    @ApiOperation(value = "#Description selectmember #Date", notes = "#Description selectmember #Date", httpMethod = "POST")
    @PostMapping("/member")
    public Result selectmember(Integer currentPage , Integer pageSize , @RequestBody Member member){
        return memberService.selectMember(currentPage,pageSize,member);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "Member", name = "member", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @MyLog(title = "修改会员")
    @PostMapping("/update")
    public Result update(@RequestBody Member member) {
        return memberService.update(member);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "HeadVo", name = "headVo", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @PostMapping("/uploadImg")
    public Result uploadImg(@RequestBody HeadVo headVo){
        return memberService.uploadImg(headVo);
    }

    @ApiOperation(value = "", notes = "", httpMethod = "GET")
    @GetMapping("/getMember")
    public Result getMember(){
        return memberService.getMember();
    }

}
